package com.sg.java.constant;

import java.util.ArrayList;
import java.util.List;

public interface Constant {

    enum SbTypeEnum {
        MX(1,"母线"),
        XL(2,"线路"),
        YH(3,"用户"),
        PB(4,"配变");



       private Integer type;
       private String desc;


        SbTypeEnum() {
        }

        SbTypeEnum(Integer type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static String getDesc(Integer type){
            for (SbTypeEnum value : SbTypeEnum.values()) {
                if(value.getType().equals(type)){
                    return value.getDesc();
                }
            }
            return null;
        }

        public static List<CommonTypeVo> getReturnCode() {
            List<CommonTypeVo> result = new ArrayList<>();
            for (SbTypeEnum typeEnum : SbTypeEnum.values()) {
                CommonTypeVo vo = new CommonTypeVo();
                vo.setType(String.valueOf(typeEnum.getType()));
                vo.setDesc(typeEnum.getDesc());
                result.add(vo);
            }
            return result;
        }
    }

    enum SbLevelEnum {
        YH("1","用户"),
        PB("2","配变"),
        XL("3","线路"),
        MX("4","母线");

        private String type;
        private String desc;


        SbLevelEnum() {
        }

        SbLevelEnum(String type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public static String getDesc(String type){
            for (SbLevelEnum value : SbLevelEnum.values()) {
                if(value.getType().equals(type)){
                    return value.getDesc();
                }
            }
            return null;
        }

        public static List<CommonTypeVo> getReturnCode() {
            List<CommonTypeVo> result = new ArrayList<>();
            for (SbLevelEnum typeEnum : SbLevelEnum.values()) {
                CommonTypeVo vo = new CommonTypeVo();
                vo.setType(typeEnum.getType());
                vo.setDesc(typeEnum.getDesc());
                result.add(vo);
            }
            return result;
        }
    }


}
